<?php

//Startar en session
session_start();

//Hämtar in nödvändiga filer
require_once ("PageCompositionView.php");
require_once ("Database.php");
require_once ("DbConfig.php");
require_once ("PageView.php");


	class MasterController{
		
		Public function DoControl(){		
			
			//Initierar och öppnar databasen.
			$dbconfig = new DbConfig();
			$db = new Database();
			$db->Connect($dbconfig);
			
			//Intantierar
			$pcv = new PageCompositionView();
			$page = new PageView();
			
			//Startar PageCompositionView
			if(!$controller = $pcv->DoControl($db)){
				$page->RemoveGet();	
			}
			
			//Stänger databasen.
			$db->Close();
			
			return $page->RenderHTMLPage("Labb3", $controller);			
			
		}
		
	}
	
echo MasterController::DoControl();

